package com.bw.controller;

import com.bw.service.FastGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class ApiController {

    @Autowired
    private FastGoodService fastGoodService;

    @RequestMapping(value = "/test")
    public Map<String,Object> hello(){
        Map<String,Object> map= new HashMap<String, Object>();
        map.put("code",1001);
        return map;
    }

    @RequestMapping(value = "/apiRatings")
    public Map<String, Object> queryRatings() {
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> list =  fastGoodService.queryRatings();
        map.put("data",list);
        return map;
    }

    @RequestMapping(value = "/apiProvinces")
    public Map<String, Object> queryProvinces() {
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> list =  fastGoodService.queryProvinces();
        map.put("data",list);
        return map;
    }

    @RequestMapping(value = "/apiActivity")
    public Map<String, Object> queryActivity() {
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> list =  fastGoodService.queryActivity();
        map.put("data",list);
        return map;
    }

    @RequestMapping(value = "/apiShopRatings")
    public Map<String, Object> queryShopRatings() {
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, Object>> list =  fastGoodService.queryShopRatings();
        map.put("data",list);
        return map;
    }
}
